import Vue from 'vue';
import Router from 'vue-router';
import Index from './views/Index.vue';
import Home from './views/Home.vue';
import Schedule from './views/Schedule.vue';
import Mine from './views/Mine.vue';

import Main from '*.vue';

Vue.use(Router);

export default new Router({
    //    mode: 'history',
    mode: 'hash',
    base: process.env.BASE_URL,
    routes: [
        {
            path: '/',
            component: Index,
            children: [
                {
                    name: 'home',
                    path: '/',
                    component: Home,
                    meta: {
                        loginAuth: false,
                        title: '首页',
                    },
                },
                {
                    name: 'schedule',
                    path: '/schedule',
                    component: Schedule,
                    meta: {
                        loginAuth: true,
                        title: '选课单',
                    },
                },
                {
                    name: 'mine',
                    path: '/mine',
                    component: Mine,
                    meta: {
                        loginAuth: false,
                        title: '个人中心',
                    },
                },
            ],
        },
        {
            path: '/login',
            name: 'login',
            component: () => import(/* webpackChunkName: "login" */ './views/Login.vue'),
            meta: {
                loginAuth: false,
                title: '登录',
            },
        },
        {
            path: '/register',
            name: 'register',
            component: () => import(/* webpackChunkName: "register" */ './views/Register.vue'),
            meta: {
                loginAuth: false,
                title: '注册',
            },
        },
        {
            path: '/courseDetail',
            name: 'courseDetail',
            component: () => import(/* webpackChunkName: "course-detail" */ './views/CourseDetail.vue'),
            meta: {
                loginAuth: false,
                title: '课程介绍',
            },
        },
        {
            path: '/emotionTest',
            name: 'emotionTest',
            component: () => import(/* webpackChunkName: "emotion-test" */ './views/EmotionTest.vue'),
            meta: {
                loginAuth: false,
                title: '情绪测试',
            },
        },
        {
            path: '/questionBank',
            name: 'questionBank',
            component: () => import(/* webpackChunkName: "question-bank" */ './views/QuestionBank.vue'),
            meta: {
                loginAuth: false,
                title: '题库',
            },
        },
        {
            path: '/lessonAndJob',
            name: 'lessonAndJob',
            component: () => import(/* webpackChunkName: "lesson-and-job" */ './views/LessonAndJob.vue'),
            meta: {
                loginAuth: false,
                title: '讲义作业',
            },
        },
        {
            path: '/recharge',
            name: 'recharge',
            component: () => import(/* webpackChunkName: "recharge" */ './views/Recharge.vue'),
            meta: {
                loginAuth: true,
                title: '学币充值',
            },
        },
        {
            path: '/curriculum',
            name: 'curriculum',
            component: () => import(/* webpackChunkName: "curriculum" */ './views/Curriculum.vue'),
            meta: {
                loginAuth: true,
                title: '课程表',
            },
        },
        {
            path: '/orderConfirm',
            name: 'orderConfirm',
            component: () => import(/* webpackChunkName: "order-confirm" */ './views/OrderConfirm.vue'),
            meta: {
                loginAuth: true,
                title: '订单确认',
            },
        },
        {
            path: '/orderList',
            name: 'orderList',
            component: () => import(/* webpackChunkName: "order-list" */ './views/OrderList.vue'),
            meta: {
                loginAuth: true,
                title: '订单列表',
            },
        },
        {
            path: '/questionSet',
            name: 'questionSet',
            component: () => import(/* webpackChunkName: "question-set" */ './views/QuestionSet.vue'),
            meta: {
                loginAuth: true,
                title: '题集',
            },
        },
        {
            path: '/questionDetail',
            name: 'questionDetail',
            component: () => import(/* webpackChunkName: "question-detail" */ './views/QuestionDetail.vue'),
            meta: {
                loginAuth: true,
                title: '答题',
            },
        },
        {
            path: '/learningPlanning',
            name: 'learningPlanning',
            component: () => import(/* webpackChunkName: "learning-planning" */ './views/LearningPlanning.vue'),
            meta: {
                loginAuth: true,
                title: '学习规划',
            },
        },
        {
            path: '/myWork',
            name: 'myWork',
            component: () => import(/* webpackChunkName: "my-work" */ './views/MyWork.vue'),
            meta: {
                loginAuth: true,
                title: '我的作业',
            },
        },
        {
            path: '/myErrors',
            name: 'myErrors',
            component: () => import(/* webpackChunkName: "my-errors" */ './views/MyErrors.vue'),
            meta: {
                loginAuth: true,
                title: '错题集',
            },
        },
        {
            path: '/myCollectQuestion',
            name: 'myCollectQuestion',
            component: () => import(/* webpackChunkName: "my-collect-question" */ './views/MyCollectQuestion.vue'),
            meta: {
                loginAuth: true,
                title: '我的收藏',
            },
        },
        {
            path: '/courseTrace',
            name: 'courseTrace',
            component: () => import(/* webpackChunkName: "course-trace" */ './views/CourseTrace.vue'),
            meta: {
                loginAuth: true,
                title: '我的收藏',
            },
        },
        {
            path: '/search',
            name: 'search',
            component: () => import(/* webpackChunkName: "search" */ './views/Search.vue'),
            meta: {
                loginAuth: true,
                title: '搜索',
            },
        },
    ],
});
